import java.awt.event.*;
import java.applet.*;
import java.awt.*;
import java.io.*;

public class PanelTest extends Applet{
	int a=10,b=20,c;
	public void init(){
		Panel p1=new Panel();
		Button sum=new Button("ADD");
		Button sub=new Button("SUB");
		TextArea result=new TextArea(150,200);
		
		p1.add(sum);
		p1.add(sub);
		p1.add(result);
		
		sum.addActionListener(new ActionListener(){
			public void ActionPerformed(ActionEvent evt){
				c=a+b;
				result.setText(" "+c);
				
			}
		});
		
		sub.addActionListener(new ActionListener(){
			public void ActionPerformed(ActionEvent evt){
				if(a>b)
					c=a-b;
				else
					c=b-a;
				result.setText(" "+c);
			}
		});
		
		add(p1);
	}
}
